<!DOCTYPE html>
<html lang="zh-CN">
  <head>
	  <%layout("/WEB-INF/view/common/inc/admin_head.html",{title:'修改数据字典分类信息', styles:'bootstrap,font-awesome,animate,style,dtvalidate'}){%>
	  <style type="text/css">
		  body{padding-top:10px;}
	  </style>
	  <%}%>
  </head>
  <body>
	<!-- START 内容部分 -->
	<div class="container">
		<form class="form-horizontal" id="info-form" method="post">
				<!-- 编号 -->
			<input type="hidden" name="id" value="${dict.id}"/>

			<div class="form-group">
				<label class="col-sm-2 control-label text-right">类型编码</label>
				<div class="col-sm-6">
					<input type="text" id="typeCode" name="typeCode" class="form-control" valid="r" validTitle="类型编码" validInfoArea="typeCode_info_area" value="${dict.typeCode}"/>
				</div>
				<div class="col-sm-4"><p class="help-block" id="type_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">名称</label>
				<div class="col-sm-6">
					<input type="text" id="name" name="name" class="form-control" valid="r" validTitle="名称" validInfoArea="name_info_area" value="${dict.name}"/>
				</div>
				<div class="col-sm-4"><p class="help-block" id="name_info_area"></p></div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label text-right">备注</label>
				<div class="col-sm-6">
					<textarea id="remark" name="remark" class="form-control" rows="3">${dict.remark}</textarea>
				</div>
				<div class="col-sm-4"><p class="help-block" id="remark_info_area"></p></div>
			</div>

			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="button" class="save-btn btn btn-primary">
						<i class="fa fa-save"></i> 提交
					</button>
				</div>
			</div>
		</form>
	</div>
	<!-- END 内容部分 -->
	
	<!-- START 公共脚本 -->
    <%layout("/WEB-INF/view/common/inc/admin_js.html",{modules:'jquery,bootstrap,dtvalidate,dtvalidate-lang-zh_cn'}){}%>
	<!-- END 公共脚本 -->
	<script>
	var cvalidator;
	$(function(){
		//初始化验证器
		cvalidator = $.fn.dlshouwen.validator.init($('#info-form'));
		
		//提交表单
		$('.save-btn').on('click',function(){
			if(!cvalidator.validResult()){
				$.fn.dlshouwen.validator.tools.toast('验证失败！', 'error', 2000);
				return;
			}
			
			//数据提交
			$.post('${ctxPath}/dict/info/usave.do',$('#info-form').serialize(),function(data){
				if( data.ok ){
					parent.layer.msg(data.msg,{icon:1,time:1500,shade: [0.8, '#393D49']}, function(){
						parent.$dicttable.bootstrapTable('refresh');
						parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭弹窗
					});
				}else{
					parent.layer.msg(data.msg,{icon: 0,time:1500,shade: [0.8, '#393D49']});
				}
			});
		});
    });
    </script>
  </body>
</html>